package com.android.aqq.bean;

import java.io.Serializable;

import edu.tsinghua.lumaqq.qq.QQ;
import edu.tsinghua.lumaqq.qq.beans.ContactInfo;
import edu.tsinghua.lumaqq.qq.beans.FriendRemark;
import edu.tsinghua.lumaqq.qq.beans.QQFriend;

public class QQBuddy implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -2038312857596479367L;
	private int qq;
	private String signature;
	private byte status; 
	private String birthday;
	private int group;
    // 头像，参看ContactInfo的头像注释
    public char head;
    // 年龄
    public byte age;
    // 性别
    public byte gender;
    // 昵称
    public String nick;
    // 用户属性标志
	// bit1 => 会员
	// bit5 => 移动QQ
	// bit6 => 绑定到手机
	// bit7 => 是否有摄像头
    // bit18 => 是否TM登录
    public int userFlag;
    // 姓名
	public String name;
	// 手机号码
	public String mobile;
	// 电话号码
	public String telephone;
	// 联系地址
	public String address;
	// 电子邮箱
	public String email;
	// 邮编
	public String zipcode;
	// 备注
	public String note;
	public byte verifyFlag;
	
	public QQBuddy(int qq) {
		this.qq = qq;
		this.status = QQ.QQ_STATUS_OFFLINE;
	}
	
	public QQBuddy(QQFriend friend) {
		this.qq = friend.qqNum;
		this.nick = friend.nick;
		this.head = friend.head;
		this.gender = friend.gender;
		this.age = friend.age;
		this.userFlag = friend.userFlag;
		this.status = QQ.QQ_STATUS_OFFLINE;
		this.group = friend.groupSeq;
	}
	
	public void setFriendInfo(QQFriend friend) {
		this.nick = friend.nick;
		this.head = friend.head;
		this.gender = friend.gender;
		this.age = friend.age;
		this.userFlag = friend.userFlag;
		this.group = friend.groupSeq;
	}
	
	public void setFriendRemark(FriendRemark friendRemark) {
		this.name = friendRemark.name;
		this.mobile = friendRemark.mobile;
		this.telephone = friendRemark.telephone;
		this.address = friendRemark.address;
		this.email = friendRemark.email;
		this.zipcode = friendRemark.zipcode;
		this.note = friendRemark.note;
	}
	
	public int getQQ() {
		return qq;
	}
	public void setQQ(int qq) {
		this.qq = qq;
	}
	public String getNick() {
		return nick;
	}
	public void setNick(String nick) {
		this.nick = nick;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSignature() {
		return signature;
	}
	public void setSignature(String signature) {
		this.signature = signature;
	}
	public byte getStatus() {
		return status;
	}
	public void setStatus(byte status) {
		this.status = status;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String phone) {
		this.telephone = phone;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getBirthday() {
		return birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public int getGroup() {
		return group;
	}
	public void setGroup(int group) {
		this.group = group;
	}

	public char getHead() {
		return head;
	}

	public void setHead(char head) {
		this.head = head;
	}

	public byte getAge() {
		return age;
	}

	public void setAge(byte age) {
		this.age = age;
	}

	public byte getGender() {
		return gender;
	}

	public void setGender(byte gender) {
		this.gender = gender;
	}

	public int getUserFlag() {
		return userFlag;
	}

	public void setUserFlag(int userFlag) {
		this.userFlag = userFlag;
	}

	public String getZipcode() {
		return zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}
	
	@Override
	public String toString() {
		if (name!=null && !name.equals("")) {
			return name;
		} else if (nick!=null && !nick.equals("")) {
			return nick;
		}
		return "" + qq;
	}
	
	public void setContactInfo(ContactInfo contactInfo) {
		this.nick = contactInfo.nick;
		this.name = contactInfo.name;
		this.mobile = contactInfo.mobile;
		this.telephone = contactInfo.telephone;
		this.address = contactInfo.address;
		this.email = contactInfo.email;
		this.zipcode = contactInfo.zipcode;
	}

	public byte getVerifyFlag() {
		return verifyFlag;
	}

	public void setVerifyFlag(byte verifyFlag) {
		this.verifyFlag = verifyFlag;
	}
}
